#include "LinkedListCycle.hpp"
#include "gtest/gtest.h"
#include "leetcode.h"

namespace
{
TEST( hasCycle, example1 )
{
    /* [3,9,20,null,null,15,7] */
    LinkedListNode node_3{ LinkedListNode( 3 ) };
    LinkedListNode node_2{ LinkedListNode( 2 ) };
    LinkedListNode node_0{ LinkedListNode( 0 ) };
    LinkedListNode node__4{ LinkedListNode( -4 ) };

    node_3.next  = &node_2;
    node_2.next  = &node_0;
    node_0.next  = &node__4;
    node__4.next = &node_2;

    bool expected = true;
    bool got      = hasCycle( &node_3 );

    ASSERT_EQ( expected, got );
}
}  // namespace